/*
 * @Descripttion: 会员列表配置
 * @version: 电子名片2.0
 * @Author: 冯健
 * @Date: 2020-11-20 18:24:45
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-04 15:49:32
 */

import { title } from "@/settings"

// el-table配置
export const listHedar = [
  { label: '会员编号', prop: 'memberId' },
  { label: '姓名', prop: 'realName' },
  { label: '手机号码', prop: 'mobile' },
  { label: '会员等级', prop: 'levelName' },
  { label: '实名认证', prop: 'authState', isTemplate: true },
  { label: '状态', prop: 'memberState', isTemplate: true },
  { label: '会员标签', prop: 'combinedTagName'},
  { label: '修改人', prop: 'modifierName' },
  { label: '修改时间', prop: 'gmtModified' },
  { label: '操作', prop: 'operate', isTemplate: true, fixed: 'right' }
]

const auths = [
  { value: '0', title: '未认证' },
  { value: '1', title: '已认证' }

]
const stutas = [
  { value: '1', title: '正常' },
  { value: '2', title: '禁用' }
]
const tags = []
// 搜索栏配置
export const searchs = [
  { type: 'input', key: 'keyword', value: '', placeholder: '会员编号、姓名、手机' },
  { type: 'select', key: 'authState', value: '', selectList: auths, placeholder: '实名认证' },
  { type: 'select', key: 'memberState', value: '', selectList: stutas, placeholder: '状态' },
  { type: 'select', key: 'tagId', value: '', selectList: tags , placeholder: '标签' ,
    handlerDate(arr){
      const _arr = []
       arr.forEach(item =>{ 
         const obj = {
           value:item.tagId,
           title:item.tagName
          }
          _arr.push(obj)
       })
       return _arr;
     }
  }
]
// 禁用框数据配置
export const setList = [
  { label:'有效时长：',key:'expire', key1:'expire1',type:'input-checkbox',name:'永久',disabled:false, have: true,placeholder:'请输入天数' }

]

// 认证框数据配置
export const textLists = [
  { type: 'image', key: 'idcardFront' },
  { type: 'image', key: 'idcardBack' },
  { type: 'image', key: 'idcardHand', span: 24, style: 'width: 40%' },
  { type: 'txt', key: 'realName', title: '姓名: ' },
  { type: 'txt', key: 'gender', title: '性别: ' },
  { type: 'txt', key: 'idcardEthnicity', title: '民族: ' },
  { type: 'txt', key: 'birthday', title: '生日: ' },
  { type: 'txt', key: 'idcardAddress', span: 24, title: '住址: ' },
  { type: 'txt', key: 'idcardNo', span: 24, title: '身份证号码: ' }
]
// 会员详情-等级信息-数据配置
export const leveInfoHeader = [
  { label: '会员等级', prop: 'memberGrad' },
  { label: '起始日期', prop: 'startTime' },
  { label: '结束日期', prop: 'endTime' },
  { label: '价格', prop: 'price' },
  { label: '获取时间', prop: 'getTime' }
  
]
// 会员详情-会员标签

export const memberTagsData = function (){

  // 添加标签框数据配置
  const recordHedar = [
    { label: '标签编号', prop: 'tagId' },
    { label: '标签名称', prop: 'tagName' },
    { label: '标签描述', prop: 'description' },
    { label: '有效时长（天）', prop: 'expire' },
    { label: '操作', prop: 'operate' ,isTemplate:true }
  ]
  // 添加标签搜索栏数据配置
  const recordSearchs = [
    { type: 'input', key: 'keyword', value: '', placeholder: '标签编号、名称' },
  ]
  // 设置标签框数据配置
  const editList = [
    { label:'会员标签名称：',key:'tagName',type:'input' , have: true},
    { label:'会员标签描述：',key:'description',type:'textarea' },
    { label:'有效时长：',key:'expire', key1:'expire1',type:'input-checkbox', name:'永久',disabled:false, have: true },
   
  ]
  // 设置标签框校验规则
  const rules = {
    tagName: { required: true, message: '请输入会员标签名称' },
    expire: { required: true, message: '请输入有效时长' }
  }
  return {
    recordHedar,
    recordSearchs,
    editList,
    rules
  }
}

// 会员详情-会员档案
export function memberDate(a) {
  // 会员所有信息
  const basics = [
      {label: '会员编号：',key:'memberId',span:24 },
      {label: '注册日期：',key:'gmtCreate',span:24 },
      {label: '会员姓名：',key:'realName',span:24 },
      {
        label: '手机号码：',
        key:'mobile',
        isHide: true,
        show(detail) {
          return this.isHide ? detail.mobile2 : detail.mobile
        } 
      },
      { label: '性别：',   key:'gender', 
        gender(val) {
          return val === '0' ? '女' : '男' 
        }
      
      },
      {
        label: '邮箱：',   
        key:'email' ,
        isHide: true,
        show(detail) {
          return this.isHide ? '' : ''
        }
      
      },
      {label: '生日：',   key:'birthday'},
      {label: '个性签名：',key:'memberSign'},
      {label: '所在城市：',key:'areaCityName',}
  ]
   //账号安全
  const securityAccount = [
    {label:'人脸识别：',key:'isFaceToken' },
    {label:'第三方平台：',key:'socials' },
  ]
  if( a ){
    return  basics 
  }
  else {
    return securityAccount
  }
}

